Skip to content

An update continues its own version, and permission holds name only what is newly allowed - #969

Merged
coderhelm[bot] merged 4 commits into
mainfrom
updater-same-version-grants
Dec 5, 2026
Merged

coderhelm[bot] merged 4 commits into
mainfrom
updater-same-version-grants

Conversation

@nambok

@nambok nambok commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

A scheduled update held for a person (it changes permissions) was prepared again by the next hourly check, and the update waiting was marked superseded by an update to its own version, every hour, so it never applied. The holds also counted policy edits that allow nothing new. Now a second start for the same version continues the prepared change set, permission changes are compared as what they allow, and an hourly check that can't start its update says so once.

Changes

  • Same version, same change set. begin looks for a prepared update to the same version first (same_version_open) and continues it (continue_open) instead of preparing a new one. The hourly check changes nothing on it and reports that it waits, with the hold. An admin's press makes it theirs, and with their OK for permission changes the same change set applies. One prepared without the deploy role the install has now, or whose change set can no longer run, is prepared again. A newer release still replaces an older one that hasn't run.
  • Permission changes compared as grants. grant_difference reads every role, policy and resource policy of a part as grants (who, action, resource, condition) on both sides. Only a grant no running one covers, or a deny or permissions boundary the new release drops, holds an update. A statement moved between policies of the same role (CDK overflow policies), a different order, a log group's ARN written with or without :*, an added condition, fewer condition values, or a removed action or resource applies by itself. NotAction, NotResource, NotPrincipal, a policy written as text, and anything that can't be resolved count whenever they differ. The hold says what becomes newly allowed, for example: newly allows sqs:GetQueueAttributes, sqs:GetQueueUrl, sqs:SendMessage on TicketQueue for the AWS service events.amazonaws.com when aws:SourceArn is MonthTurnSchedule. Lambda permissions, function URLs and other IAM types keep the comparison they had.
  • Release notes. iam_diff.py uses the same comparison, so the notes list the same changes an install would hold for.
  • A refused hourly start. The tick catches the refusal, writes the row, and goes on with reminders and the digest (before, the refusal ended the check). The second refusal in a row of the same version emails the admins once (the existing update notice, failed), and GET /api/system/version returns it as auto_refused. A held update already emails once ("needs your OK") and shows its hold on Settings, System.
  • Docs: docs/self-host/updates.md (what counts as a permission change, same-version updates, the email). Incident case xs_update_continues_its_own_version.

Verification

  • python3 -m unittest discover -s lambda/tests: 664 tests pass. New: test_updater_same_version.py replays hourly checks and 5-minute polls against a change set CloudFormation takes hours to make, and one held for a person; each ends applied with one change set and no superseded row. On the previous handler the held replay made a change set every hour and the slow one was refused. test_updater_grants.py covers widening (held, named), narrowing (applied), reorder and equivalent rewrites including an overflow move and a log group's two ARNs (applied), a new resource ARN (held), a dropped deny or boundary (held), and the scheduled path end to end.
  • python3 -m unittest discover -s .github/scripts: 222 pass. iam_diff.py diff run on two published releases' native templates: the log group rewrite is no longer listed; the queue policy's new sender is, in the words above.
  • check_workflows.py, brand_spelling.py, domain_examples.py pass. The new incident case is rustfmt --check clean and its string checks were run against the handler; the full incidents:: suite runs in CI.

…hat is newly allowed

A scheduled update held for a person (it changes permissions) left no
update "running", so the next hourly check prepared the same release
again and marked the waiting one superseded by its own version, every
hour, and it never applied. A change set CloudFormation took longer than
the running limit to make was refused the same way.

- begin: a second start for the same version (the hourly check, an
  admin's press, a waiting press) continues the prepared change set
  (same_version_open, continue_open). An admin's press with their OK for
  permission changes lets that change set apply. A newer release still
  replaces an older one that hasn't run.
- Permission changes are compared as grants (who, action, resource,
  condition) across every role, policy and resource policy of a part
  together (grant_difference). Only a grant no running one covers, or a
  deny or boundary the new release drops, holds an update, and the hold
  says what becomes newly allowed. A statement moved between a role's
  policies, a different order, a log group's ARN with or without ":*",
  an added condition or a removed action applies by itself. NotAction,
  NotResource and NotPrincipal statements, and anything that can't be
  compared, still count whenever they differ. The release notes
  (iam_diff.py) use the same comparison.
- The hourly check: a refused start writes its row and the check goes on
  (reminders, the digest); the second refusal in a row of the same
  version emails the admins once (the update notice), and the status
  route returns it as auto_refused.
- Tests: hourly ticks and 5-minute polls against a slow change set end
  applied with one change set and nothing superseded; a held update is
  never prepared again and applies on the admin's OK; widening,
  narrowing, equivalent and new-ARN cases for the grant comparison.
  Incident case xs.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 4, 2026
coderhelm[bot]

This comment was marked as outdated.

…let ? cover * in a grant

- begin's refusals (written to history as not_started) raise StartRefused.
  The hourly check counts and emails only those; a wait (ReleaseNotReady,
  another update still being prepared or running) writes nothing, sends
  nothing, and leaves the count as it is.
- Grant coverage compares pattern with pattern (_pattern_covers): a ? in
  the running grant covers one character or a ?, never a *; only a * covers
  a * in the new grant. Used for actions and resources, so the release
  notes (iam_diff.py) follow it too.
- Tests: waits never counted or emailed, a wait between refusals, begin
  marking only its recorded refusals; ?, * and mixed patterns, a running ?
  against a new *, and the release notes path.
coderhelm[bot]

This comment was marked as outdated.

@coderhelm
coderhelm Bot dismissed their stale review December 5, 2026 02:33

Superseded by CoderHelm's latest review

@coderhelm

coderhelm Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

💚 Post-merge health check passed: the deploy of 0154c97 completed and stayed green for the full 15-minute watch window (no new failures vs. the pre-merge baseline).
Auto-merge

  • ✅ CoderHelm approved
  • ✅ CI green
    The rest is in the pull request description.

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved with notes 48a4696 (merged)

@coderhelm
coderhelm Bot merged commit 0154c97 into main Dec 5, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant